package com.huohuzhihui.controller;

import com.huohuzhihui.client.AssetClient;
import com.huohuzhihui.client.DigitalAssetClient;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple2;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple7;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigInteger;

@RequestMapping("/asset")
@RestController
public class AssetController {
    @Autowired
    AssetClient assetClient;
    @Autowired
    DigitalAssetClient digitalAssetClient;

    @RequestMapping("/query")
    public Tuple2<BigInteger, BigInteger> query(String assetAccount){

        return this.assetClient.queryAssetAmount(assetAccount);
    }

    @RequestMapping("/queryDigital")
    public Tuple7<BigInteger, String, String, String, String, BigInteger, BigInteger> queryDigital(String assetAccount){

        return this.digitalAssetClient.query(assetAccount);
    }

    @RequestMapping("/registerDigital")
    public String  registerDigital(String asset_id, String asset_name,
                                                                          String creator_address, String asset_hash, String asset_amount, String asset_price){

        return this.digitalAssetClient.register( asset_id,  asset_name,
                creator_address,  asset_hash,  asset_amount,  asset_price);
    }
}
